function Match(){
    var id;
    var groupId;
    var team1;
    var team2;
    var pointsTeam1;
    var pointsTeam2;
    var startDateTime;
    var location;
    var goals = [];

    this.setId = function(matchid){
        id = matchid;
    }
    this.getId = function(){
        return id;
    }
    
    this.setGroupId = function(gId){
        groupId = gId;
    }
    this.getGroupId = function(){
        return groupId;
    }
    
    this.setTeam1 = function(teamname){
        team1 = teamname;
    }
    this.getTeam1 = function(){
        return team1;
    }
    
    this.setTeam2 = function(teamname){
        team2 = teamname;
    }
    this.getTeam2 = function(){
        return team2;
    }
    this.addGoal = function(goal){
        goals.push(goal);
    }
    this.getGoals = function(){
        return goals;
    }

    this.setTeam1Points = function(score) {
        pointsTeam1 = score;
    }

    this.getTeam1Points = function() {
        return pointsTeam1;
    }

    this.setTeam2Points = function(score) {
        pointsTeam2 = score;
    }

    this.getTeam2Points = function() {
        return pointsTeam2;
    }

    this.setStartDateTime = function(newStartDateTime) {
        startDateTime = newStartDateTime;
    }

    this.getStartDateTime = function() {
        return startDateTime;
    }

    this.setCity = function(city) {
        location = city;
    }

    this.getCity = function() {
        return location;
    }
}

Match.prototype.getDatabaseObject = function(){
    return {
        id                      : this.getId(),
        team1                   : this.getTeam1(),
        team2                   : this.getTeam2(),
        team1Points             : this.getTeam1Points(),
        team2Points             : this.getTeam2Points(),
        startDateTime           : this.getStartDateTime(),
        groupId                 : this.getGroupId(),
        location                : this.getCity()
    };
}

Match.prototype.convertToBusinessObject = function(dbObject){
    this.setId(dbObject.id);
    this.setTeam1(dbObject.team1);
    this.setTeam2(dbObject.team1);
    this.setTeam1Points(dbObject.team1Points);
    this.setTeam2Points(dbObject.team2Points);
    this.setStartDateTime(dbObject.startDateTime);
    this.setGroupId(dbObject.groupId);
    this.setCity(dbObject.location);
}